package com.atguigu.encapsulation;

/**
 * @ClassName Student
 * @Description TODO
 * @Author hp
 * @Date 2021/6/11 11:04
 * @Version 1.0
 **/
public class Student {
    private String name ;
    private int age ;
    private int id;

    public void setName(String name){
        this.name = name;
    }
    public String getName(){
        return name;
    }

    public void setAge(int age){

            if (age>=0||age<120){
                this.age = age;
            }

    }
    public int getAge(){
        return age;
    }
    public void  setId(int id){
        this.id = id;
    }
    public int getId(){
        return id;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", id=" + id +
                '}';
    }
}
